package com.klw.business.service.impl;

import java.math.BigDecimal;
import java.util.List;

import com.klw.business.domain.KlmBatchModel;
import com.klw.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.klw.business.mapper.KlwCoursesMapper;
import com.klw.business.domain.KlwCourses;
import com.klw.business.service.IKlwCoursesService;

/**
 * 课程信息Service业务层处理
 * 
 * @author klw
 * @date 2025-08-24
 */
@Service
public class KlwCoursesServiceImpl implements IKlwCoursesService 
{
    @Autowired
    private KlwCoursesMapper klwCoursesMapper;

    /**
     * 查询课程信息
     * 
     * @param courseId 课程信息主键
     * @return 课程信息
     */
    @Override
    public KlwCourses selectKlwCoursesByCourseId(Long courseId)
    {
        return klwCoursesMapper.selectKlwCoursesByCourseId(courseId);
    }

    /**
     * 查询课程信息列表
     * 
     * @param klwCourses 课程信息
     * @return 课程信息
     */
    @Override
    public List<KlwCourses> selectKlwCoursesList(KlwCourses klwCourses)
    {
        return klwCoursesMapper.selectKlwCoursesList(klwCourses);
    }

    /**
     * 新增课程信息
     * 
     * @param klwCourses 课程信息
     * @return 结果
     */
    @Override
    public int insertKlwCourses(KlwCourses klwCourses)
    {
        klwCourses.setCreateTime(DateUtils.getNowDate());
        return klwCoursesMapper.insertKlwCourses(klwCourses);
    }

    /**
     * 修改课程信息
     * 
     * @param klwCourses 课程信息
     * @return 结果
     */
    @Override
    public int updateKlwCourses(KlwCourses klwCourses)
    {
        klwCourses.setUpdateTime(DateUtils.getNowDate());
        return klwCoursesMapper.updateKlwCourses(klwCourses);
    }

    /**
     * 批量删除课程信息
     * 
     * @param courseIds 需要删除的课程信息主键
     * @return 结果
     */
    @Override
    public int deleteKlwCoursesByCourseIds(Long[] courseIds)
    {
        return klwCoursesMapper.deleteKlwCoursesByCourseIds(courseIds);
    }

    /**
     * 删除课程信息信息
     * 
     * @param courseId 课程信息主键
     * @return 结果
     */
    @Override
    public int deleteKlwCoursesByCourseId(Long courseId)
    {
        return klwCoursesMapper.deleteKlwCoursesByCourseId(courseId);
    }

    /**
     * 获取学生制定学期学分总和
     * @param klmBatchModel
     * @return
     */
    @Override
    public BigDecimal selectCreditScoreByParam(KlmBatchModel klmBatchModel) {
        return klwCoursesMapper.selectCreditScoreByParam(klmBatchModel);
    }
}
